//
//  NotesInfoCell.m
//  hai游～
//
//  Created by dllo on 15/5/22.
//  Copyright (c) 2015年 jakf_17. All rights reserved.
//

#import "NotesInfoCell.h"

@implementation NotesInfoCell


//@property (nonatomic, retain) UILabel *titleLabel;
//@property (nonatomic, retain) UILabel *dayLabel;
//@property (nonatomic, retain) UIView *destinationView;
//@property (nonatomic, retain) UIImageView *mapImageView;
//@property (nonatomic, retain) UIImageView *userImageView;

- (void)dealloc
{
    [_titleLabel release];
    [_dayLabel release];
    [_destinationView release];
    [_mapImageView release];
    [_userImageView release];
    [_distanceLabel release];
    [_destinationLabel release];
    [_countryImageview release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.length_375 = self.contentView.frame.size.width;
        self.length_15 = self.length_375 / 25.0;
        self.length_75 = self.length_375 / 5.0;
        self.length_85 = self.length_375 / 4.5;

        [self createMapImageView];
        [self createUserView];
        [self createViewOfDestination];
    }
    return self;
}
- (void)layoutSubviews
{
    //R 214 G 213 B 183 R 230 G 206 B 172
    [super layoutSubviews];
    self.contentView.backgroundColor = [UIColor whiteColor];
//    self.contentView.backgroundColor = [UIColor colorWithRed:230 / 255.0 green:206 / 255.0 blue:172 / 255.0 alpha:1.0];

}
#pragma mark 用户信息,标题,天数
- (void)createUserView
{
    UIView *userView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.length_375, self.length_85)];
    userView.backgroundColor = [UIColor clearColor];
    // 头像
    self.userImageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.length_15, self.length_15, self.length_85 - 2 * self.length_15, self.length_85 - 2 * self.length_15)];
    self.userImageView.layer.cornerRadius = self.userImageView.frame.size.width / 2.0;
    self.userImageView.layer.masksToBounds = YES;
    
    // 标题
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.length_15 * 5, self.length_15, self.length_375 - self.length_15 * 5, self.userImageView.frame.size.width / 2.0)];
    self.dayLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.length_15 * 5, self.userImageView.frame.size.width / 1.1, self.length_375 - self.length_15 * 5, self.length_15)];
    _dayLabel.text = @"";
    [userView addSubview:self.titleLabel];
    [userView addSubview:self.userImageView];
    [userView addSubview:self.dayLabel];
    
    [self.contentView addSubview:userView];
    [_userImageView release];
    [_titleLabel release];
    [_dayLabel release];
    [userView release];
}

#pragma mark 地图信息
- (void)createMapImageView
{
    self.mapImageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.length_15 * 2, self.length_85, self.length_375 , self.length_75 * 2.4)];
//    self.mapImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height - 40)];
    // self.width 为375左右
    // self.width / 4.5 为84左右
    // self.width / 5.0 为75左右
    // self.width / 25.0 为15左右
    self.mapImageView.backgroundColor = [UIColor whiteColor];
//    self.mapImageView.contentMode = UIViewContentModeCenter;
    [self.contentView addSubview:self.mapImageView];
    [self.mapImageView release];
}

#pragma mark 目的地信息
- (void)createViewOfDestination
{
    self.destinationView = [[UIView alloc] initWithFrame:CGRectMake(self.length_15 * 2, _length_85 + _length_75 * 2.4, _length_375 , _length_85)];
    _destinationView.backgroundColor = [UIColor whiteColor];
    
    self.distanceLabel = [[UILabel alloc] initWithFrame:CGRectMake(4, 0, _length_375 - _length_15 * 2, _length_85 / 2.5)];
    self.distanceLabel.text = @"";
    self.countryImageview = [[UIImageView alloc] initWithFrame:CGRectMake(_length_15, _length_85 / 2.1, _length_85 / 2.5, _length_85 / 2.5)];
    _countryImageview.layer.cornerRadius = _length_85 / 5.0;
    _countryImageview.layer.masksToBounds = YES;
    self.destinationLabel = [[UILabel alloc] initWithFrame:CGRectMake(_length_85 / 1.3, _length_85 / 2.1, _length_85 * 3.4, _length_85 / 2.5)];
    self.destinationLabel.text = @"";
    [_destinationView addSubview:_destinationLabel];
    [_destinationView addSubview:_distanceLabel];
    [_destinationView addSubview:_countryImageview];
    [self.contentView addSubview:_destinationView];
    
    [_destinationView release];
    [_destinationLabel release];
    [_countryImageview release];
    [_distanceLabel release];
    
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
